#!/bin/sh

# if [ ! -e target/boot.img ]; then dd if=/dev/zero of=boot.img~ count=2097152 >/dev/null; fi
if [ ! -e target/boot.img ]; then dd if=/dev/zero of=boot.img~ bs=512 count=10000 >/dev/null; fi
dd if=target/boot_sect.bin of=boot.img~ bs=512 conv=notrunc 2>/dev/null
dd if=target/boot_s1.bin of=boot.img~ bs=512 seek=1 conv=notrunc count=`cat target/boot_s1_size` 2>/dev/null
dd if=target/kernel of=boot.img~ bs=512 seek=$(( `cat target/boot_s1_size` + 1 )) conv=notrunc 2>/dev/null
mv boot.img~ target/boot.img
